#include <stdio.h>
#include <vector>
#include <string>
#include <map>

using namespace std;

string destCity(vector<vector<string>>& paths) {
  map<string, int> isHeadMap;
  map<string, int> times;

  for (auto& path: paths) {
    auto& name1 = path[0];
    auto& name2 = path[1];

    times[name1]++;
    times[name2]++;

    isHeadMap[name1] = 0;
    isHeadMap[name2] = 1;
  }

  for (auto& pair: times) {
    if (pair.second == 1) {
      auto& name = pair.first;
      if (isHeadMap[name] == 1) {
        return name;
      }
    }
  }

  return "";
}

int main () {
  vector<vector<string>> paths{
    {"B", "C"}, {"D", "B"}, {"C", "A"}
  };
  auto r = destCity(paths);
  printf("Hello %s\n", r.c_str());
}